/*
 * BinaryOrOperatorAst.cpp
 *
 *  Created on: 1 Nov 2010
 *      Author: ph1109
 */

#include "BinaryOrOperatorAst.h"

namespace MAlice {

BinaryOrOperatorAst::BinaryOrOperatorAst(ExpressionAst* lhs, ExpressionAst* rhs) :
	BinaryOperatorAst("|", lhs, rhs) {
}

BinaryOrOperatorAst::~BinaryOrOperatorAst() {
}

llvm::Value* BinaryOrOperatorAst::generate() {
	llvm::Value* LHS = getLHS()->generate();
	llvm::Value* RHS = getRHS()->generate();

	checkType(LHS, RHS);

	llvm::IRBuilder<>* builder = MAlice::Codegen::get()->getBuilder();

	return builder->CreateOr(LHS, RHS, getName(LHS, RHS));
}

}
